﻿package mortal.game.view.npc.render
{
    import com.mui.controls.*;
    import flash.events.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.view.common.*;
    import mortal.game.view.npc.data.*;
    import mortal.mvc.core.*;

    public class NpcFunctionRender extends GCellRenderer
    {
        private var _txt:GTextFiled;
        private var _info:NpcFunctionData;

        public function NpcFunctionRender()
        {
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            this._info = param1 as NpcFunctionData;
            this._txt.htmlText = "<u><a href=\'event:0\'>" + this._info.desc + "</a></u>";
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._txt = UIFactory.gTextField("", 0, 0, 230, 20, this);
            this._txt.configEventListener(MouseEvent.CLICK, this.textClickHandler);
            return;
        }// end function

        private function textClickHandler(event:MouseEvent) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.NPC_ClickNpcFunction, this._info));
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._txt.dispose(param1);
            this._txt = null;
            return;
        }// end function

        override public function set label(param1:String) : void
        {
            return;
        }// end function

    }
}
